package com.epam.manager;

import com.epam.entity.Bill;
import com.epam.entity.Car;
import com.epam.entity.Status;
import com.epam.manager.backingbeans.ActiveRequestManagedBean;
import com.epam.manager.backingbeans.ClosedRequestManagedBean;
import com.epam.manager.backingbeans.NewRequestManagedBean;

@SuppressWarnings("unused")
public class ManagerController {

	
	private ActiveRequestManagedBean activeRequestManagedBean;
	private ClosedRequestManagedBean closedRequestManagedBean;
	private NewRequestManagedBean newRequestManagedBean;
	
	public String closeRequest() {
//		log.debug("request " + request);
//		request.setStatus(Status.CLOSED);
//		requestDAO.update(request);
//
//		Car car = request.getCar();
//		car.setIsAvaliable(true);
//		carDAO.update(car);
		return null;
	}
//ActiveRequestManagedBean
	public String makeAdditionalBill() {	
//		bill.setRequest(request);
//		bill.setStatus(Status.NOT_PAYED);
//		billDAO.create(bill);
		return null;
	}
//ClosedRequestBean
	public String updateRequest() {
//		log.debug("ClosedRequestManagedBean updateRequest " + request);
//		requestDAO.update(request);
		return null;
	}
//NewRequestManagedBean	
	public String cancelRequest() {
//		request.setStatus(Status.CANCELLED);
//		requestDAO.update(request);
//
//		Car car = request.getCar();
//		car.setIsAvaliable(true);
//		carDAO.update(car);
		return null;
	}

	public String approveRequest() {
//		request.setStatus(Status.APPROVED);
//
//		long days = (request.getEndDate().getTime() - request.getBeginDate()
//				.getTime()) / (1000 * 60 * 60 * 24);
//
//		double sum = request.getCar().getRentRate() * days;
//		sum *= 100;
//		sum = (double) Math.round(sum) / 100;
//
//		Bill bill = new Bill(request, sum, Status.NOT_PAYED, "RENT PAYMENT");
//		billDAO.create(bill);
//
//		requestDAO.update(request);
		return null;
	}
	
	public String confirmRayment(){
		return null;
	}
}
